home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / langs / dl_exsrc.zoo / substr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-05  |  357 b   |  18 lines

  1. #include "extras.h"
  2.  
  3. char *substr(dest, source, start, end)
  4.   char *dest;
  5.   const char *source;
  6.   int start, end;
  7. {
  8.   register char *t = dest;
  9.   register int length = end - start + 1;    /* make sure to include the
  10.                            last character  :-} */
  11.  
  12.   source += start;
  13.   while (--length >= 0)
  14.     *t++ = *source++;
  15.   *t = '\0';
  16.   return dest;
  17. }
  18.